{% set apache_cmd = 'apache2' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd' %}
{% set apache_dir = 'apache2/conf-enabled' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd/conf.d' %}
{% set apache_file = '000-default.conf' if kolla_base_distro in ['ubuntu', 'debian'] else 'horizon.conf' %}
{% set services = [
    ( 'ceilometer', enable_ceilometer ),
    ( 'cinder', enable_cinder ),
    ( 'cloudkitty', enable_horizon_cloudkitty ),
    ( 'designate', enable_horizon_designate ),
    ( 'freezer', enable_horizon_freezer ),
    ( 'glance', enable_glance ),
    ( 'heat', enable_heat ),
    ( 'ironic', enable_horizon_ironic ),
    ( 'keystone', enable_keystone ),
    ( 'karbor', enable_horizon_karbor ),
    ( 'magnum', enable_horizon_magnum ),
    ( 'manila', enable_horizon_manila ),
    ( 'mistral', enable_horizon_mistral ),
    ( 'murano', enable_horizon_murano ),
    ( 'neutron', enable_neutron ),
    ( 'nova', enable_nova ),
    ( 'qinling', enable_horizon_qinling ),
    ( 'sahara', enable_horizon_sahara ),
    ( 'searchlight', enable_horizon_searchlight ),
    ( 'senlin', enable_horizon_senlin ),
    ( 'solum', enable_horizon_solum ),
    ( 'tacker', enable_horizon_tacker ),
    ( 'trove', enable_horizon_trove ),
    ( 'watcher', enable_horizon_watcher )
] %}

{
    "command": "/usr/sbin/{{ apache_cmd }} -DFOREGROUND",
    "config_files": [
        {
            "source": "{{ container_config_directory }}/horizon.conf",
            "dest": "/etc/{{ apache_dir }}/{{ apache_file }}",
            "owner": "horizon",
            "perm": "0600"
        },
{% for path in custom_policy %}
        {
            "source": "{{ container_config_directory }}/{{ path | basename }}",
            "dest": "/etc/openstack-dashboard/{{ path | basename }}",
            "owner": "horizon",
            "perm": "0600"
        },
{% endfor %}
        {
            "source": "{{ container_config_directory }}/local_settings",
            "dest": "/etc/openstack-dashboard/local_settings",
            "owner": "horizon",
            "perm": "0600"
        },
        {
            "source": "{{ container_config_directory }}/custom_local_settings",
            "dest": "/etc/openstack-dashboard/custom_local_settings",
            "owner": "horizon",
            "perm": "0600"
        }
    ]
}
